//
//  CollectionPrettyCell.m
//  YuDou
//
//  Created by qiupeng on 2018/6/24.
//  Copyright © 2018年 yingqi. All rights reserved.
//

#import "CollectionPrettyCell.h"

@interface CollectionPrettyCell()

@property (nonatomic ,weak) IBOutlet UIButton *cityBtn;
@property (nonatomic ,weak) IBOutlet UIImageView *iconImageView;
@property (nonatomic ,weak) IBOutlet UIButton *onlineBtn;
@property (nonatomic ,weak) IBOutlet UILabel *nickNameLabel;

@end

@implementation CollectionPrettyCell

- (void)setAnchor:(AnchorModel *)anchor
{
    super.anchor = anchor;
    
    [self.cityBtn setTitle:anchor.anchor_city forState:UIControlStateNormal];
    
    NSString *onlineStr = @"";
    if (anchor.online >= 10000 ){
        onlineStr = [NSString stringWithFormat:@"%.1f万", (CGFloat)anchor.online / 10000];
    }else{
        onlineStr = [NSString stringWithFormat:@"%zd",anchor.online];
    }
    [self.onlineBtn setTitle:onlineStr forState:UIControlStateNormal];
    self.nickNameLabel.text = anchor.nickname;

    if (anchor.vertical_src) {
        [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:anchor.vertical_src]];
    }
 
}
@end
